<?php

namespace App\Models\fund;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\fund\Integral
 *
 * @property int $id
 * @property int $integral 积分数量
 * @property string $title 来源
 * @property int $user_id 关联用户ID
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereIntegral($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\fund\Integral whereUserId($value)
 * @mixin \Eloquent
 */
class Integral extends Model
{
    protected $fillable = [
        'integral',
        'title',
        'user_id',
    ];


    public function getIntegralAttribute($value)
    {

        if ($value > 0){
            return '+'.$value;
        }
        return (string) $value;

    }

}
